package com.etooling.framework.repository;


import com.etooling.framework.entity.FileResource;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface FileResourceRepository extends BaseRepository<FileResource> {

    @Query(nativeQuery = true, value = "select * from framework.t_file_resource a where a.status='应用中' and a.type=?1 limit 1 ")
    FileResource getByApplyResource(String resourceType);

    @Transactional
    @Modifying
    @Query(nativeQuery = true, value = "update framework.t_file_resource  rc set status='' where  rc.type=?1  ")
    Integer clearResource(String resourceType);

}
